# from .route import *
import falcon

run = falcon.API()
falcon.RequestOptions.auto_parse_form_urlencoded = True

class SinkAdapter(object):
    def __call__(self, req, resp):
        print(req.path)
        if req.path == '/':
            resp.media = '首页, welcome'
            resp.status = falcon.HTTP_200
            return
        resp.status = falcon.HTTP_404
        resp.media = '路由错误'

run.add_sink(SinkAdapter())


# route
from .demo import DemoResource
from .images import ImagesResource

# 注意该框架只支持  x-www-form-urlencoded 提交方式
# 路由
run.add_route('/demo', DemoResource() )
run.add_route('/images', ImagesResource() )
run.add_route('/user', ImagesResource() )


# 启动  gunicorn look.app:run




